package com.mqy.entity;

import org.apache.commons.lang.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

@SuppressWarnings("serial")
public class UserLocation {

  /**
   * id
   */
  
  private String id;
  /**
   * s userId : 用户id
   */
  
  private Long userId;
  /**
   * s address : 地址名称
   */
  
  private String address;
  /**
   * s lng : 经度
   */
  
  private Double lng;
  /**
   * s lat : 纬度
   */
  
  private Double lat;
  /**
   * s createTime :记录时间
   */
  
  private Date createTime;

  private String createTime2;


  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public Long getUserId() {
    return userId;
  }

  public void setUserId(Long userId) {
    this.userId = userId;
  }

  public Double getLng() {
    return lng;
  }

  public void setLng(Double lng) {
    this.lng = lng;
  }

  public Double getLat() {
    return lat;
  }

  public void setLat(Double lat) {
    this.lat = lat;
  }

  public Date getCreateTime() {

    if (this.createTime == null && StringUtils.isNotBlank(this.createTime2)) {
      try {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.createTime = simpleDateFormat.parse(this.createTime2);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getCreateTime2() {
    return createTime2;
  }

  public void setCreateTime2(String createTime2) {
    this.createTime2 = createTime2;
  }


  @Override
  public String toString() {
    return "UserLocation{" + "id='" + id + '\'' + ", userId=" + userId + ", address='" + address + '\'' + ", lng=" +
            lng + ", lat=" + lat + ", createTime=" + createTime + ", createTime2='" + createTime2 + '\'' + '}';
  }
}
